package collection;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;


public class Test2 {
    public static void main(String[] args) {
        List<Integer>list=new ArrayList<>();
        for (int i=0;i<10;i++){
            list.add((int)(Math.random()*1000));
        }
        System.out.println(list);
        Collections.sort(list);
        System.out.println(list);
        Collections.sort(list, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2-o1;
            }
        });
        System.out.println(list);
    }
}
